package apps.web.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;

import apps.web.controller.base.MyBaseCommandController;
import apps.web.model.User;

public class CIQUserAuthorityController extends MyBaseCommandController {

	@Override
	protected ModelAndView handleInner(HttpServletRequest request,
			HttpServletResponse response, Object command) {
		User user = (User) command;
		String[] authoritys = request.getParameterValues("authority");
		if (authoritys == null) {
			authoritys = new String[0];
		}
		getServiceContainer().getUserService().updateUserRight(user.getId(),
				authoritys);
		return new ModelAndView(new RedirectView("CIQUserSearch.do?id="
				+ user.getId()));
	}

}
